-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ensure docker images can build in pipeline #1208
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
This stack of pull requests is managed by Graphite. Learn more about stacking. |
8f66d1c
to
336f8b5
Compare
336f8b5
to
8225c02
Compare
5638784
to
e85b7e6
Compare
e6373c6
to
d007dfe
Compare
496d673
to
0558a88
Compare
0558a88
to
6684804
Compare
c8f5ed0
to
639324b
Compare
6684804
to
eeb1ee7
Compare
eeb1ee7
to
1fc2e0c
Compare
1fc2e0c
to
900bec7
Compare
900bec7
to
17387ff
Compare
17387ff
to
00299da
Compare
import path from "node:path" | ||
import { URL } from "node:url" | ||
|
||
export async function resolve(specifier, context, nextResolve) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rewrites ../index
to ../index.ts
for node imports. This means things work well with both next's build system and node --strip-experimental-types
"private": true, | ||
"exports": { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needed, so that types
only imports schemas, and none of the actual Prisma client stuff. The prisma client breaks on Vercel (and shouldn't be used there for any reason either).
Same goes for the test harness
@@ -6,7 +6,7 @@ generator zod { | |||
provider = "zod-prisma-types" | |||
output = "../src/schemas" | |||
|
|||
useMultipleFiles = true | |||
useMultipleFiles = false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Node does not support directory import, and this codegenerator generates directory import when using multiple files.
import { type Prisma, PrismaClient } from "@prisma/client" | ||
import { createRequire } from "node:module" | ||
import type { Prisma, PrismaClient } from "@prisma/client" | ||
import type { DefaultArgs } from "@prisma/client/runtime/library" | ||
|
||
export * as schemas from "./schemas" | ||
const require = createRequire(import.meta.url) | ||
const { Prisma: _Prisma, PrismaClient: _PrismaClient } = require("@prisma/client") | ||
export type * from "@prisma/client" | ||
|
||
export const PrismaRuntime = _Prisma | ||
export const PrismaClientRuntime = _PrismaClient | ||
export type DBClient = PrismaClient<Prisma.PrismaClientOptions, never, DefaultArgs> | ||
export const createPrisma = (databaseUrl: string): DBClient => | ||
new PrismaClient({ | ||
new _PrismaClient({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prisma does not generate ESM module code, so we have to createRequire() and require it here. For this reason, the Prisma
export cannot be both the client and namespace (like the generated client does).
Therefore we have to distinguish between Prisma namespace (re-exported from the client), and the runtime values.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This means the Dockerfile build was broken in #1168 , but we never noticed because CI never built them. We'd have to do this at some point anyways
The docker build is now tested in CI
This introduces some internal changes, explained in review comments